package com.dat255.tentatime.testGUI;

import android.test.ActivityInstrumentationTestCase2;
import android.widget.Button;
import android.widget.EditText;

import com.dat255.tentatime.FindActivity;

public class TestFindGUI extends ActivityInstrumentationTestCase2<FindActivity> {

	//Variables
	private FindActivity mFindActivity;;
	private EditText etFind;
	private Button bFind;
	private String resourceStringButtonHintFind;
	private String resourceStringButtonName;
	
	public TestFindGUI() {
		super("com.dat255.tentatime", FindActivity.class);
	}
	@Override
	protected void setUp() throws Exception {
		super.setUp();
		//Activate touchmode
		setActivityInitialTouchMode(true);
		//Get Activity
		mFindActivity = this.getActivity();
		//Initialize Components
		etFind = (EditText) mFindActivity.findViewById(com.dat255.tentatime.R.id.etFind);
		bFind = (Button) mFindActivity.findViewById(com.dat255.tentatime.R.id.bFind);
		//Set resources	
//		resourceStringName = "Default";
//		resourceStringId = "ABC123";
		resourceStringButtonHintFind = mFindActivity.getString(com.dat255.tentatime.R.string.hintFind);
		resourceStringButtonName = mFindActivity.getString(com.dat255.tentatime.R.string.titleFind);
	}
	/**
	 * Test EditView components, if they exists are visible and
	 * got the correct name
	 */
	public void textEditText() {
		//Check if component exists
		assertNotNull(etFind);
		//Check if component is visible on the screen
		assertTrue(etFind.isShown());
		//Check if component got correct hint
		assertTrue(resourceStringButtonHintFind.equals(etFind.getHint()));
	}
	/**
	 * Test Button components, if the exists are visible and
	 * got the correct name
	 */
	public void testButtons() {
		//Check if component exists
		assertNotNull(bFind);
		//Check if component is visible on the screen
		assertTrue(bFind.isShown());
		//Check if component is clickable
		assertTrue(bFind.isClickable());
		//Check if component got correct name
		assertTrue(resourceStringButtonName.equals(bFind.getText()));
	}
}
